
<?php include './application/views/top.php'; ?>
<script src="/static/js/ajaxfileupload.js"></script>
<script src="/static/js/formCheck.js"></script>

<div class="clear"></div>
<div class="user_bottom all"></div>
<div class="clear h50"></div>
<div class="layout uc">
	<?php include './application/views/user/left.php'; ?>
	<div class="right">
		<div class="menu_list"><?php include './application/views/user/menu.php'; ?></div>
		<div class="cont">
        <form id="phone_form">
        <input type="hidden" value="" name="act" id="act">
        <?php if($user['phone_status'] == 11){ ?>
        	<div class="tishi">您的手机已经通过认证：<?php echo strdisplay($user['phone'], 4); ?>。</div>
		<?php }elseif($user['phone_status'] == 1 || $user['phone_status'] == 2){ ?>
			<dl class="line">
				<dt>手机号码：</dt>
                <dd>
					<input class="input" type="text" value="<?php echo isset($user['phone']) ? $user['phone'] : ''; ?>" name="phone" id="phone" maxlength="11">
					<input type="button" class="p_button" value="重新获取验证码" onclick="phoneSubmit('apply');">
                </dd>
			</dl>
			<dl class="line">
				<dt>验证码：</dt>
                <dd>
					<input class="input" type="text" value="" name="verify_code" maxlength="12">
					<input type="button" class="p_button" value="提交验证码" onclick="phoneSubmit('verify')">
                </dd>
			</dl>
		<?php }else{ ?>
			<dl class="line">
				<dt>手机号码：</dt>
                <dd>
					<input class="input" type="text" value="<?php echo isset($user['phone']) ? $user['phone'] : ''; ?>" name="phone" id="phone" maxlength="11">
					<input type="button"  class="p_button"  value="点击获取验证码" onclick="phoneSubmit('apply');">
                </dd>
			</dl>
		<?php } ?>
        </form>
		</div>
	</div>
</div>
<div class="clear h50"></div>
<?php include "./application/views/footer.php";?>
                        <script>
                            function phoneSubmit(txt){
                                $('#act').val(txt);
                                var options = {
                                    url : '',
                                    //clearForm :true,
                                    //resetForm :true,
                                    beforeSubmit:  checkForm,
                                    dataType: "json",
                                    type:"post",
                                    success : function(ret) {
                                        $('#dialog').dialog({
                                            modal:true,
                                            title:'系统提示',
                                            buttons:{"确定":function(){$(this).dialog("close");}},
                                            close: function() {
                                                if(ret.url==''){
                                                    window.location='/user/phone';
                                                }else{
                                                    window.location=ret.url;
                                                }
                                            }
                                        });
                                        $("#msg").html(ret.msg);
                                    }
                                };
                                $("#phone_form").ajaxSubmit(options);
                                return false;
                            }
                            function checkForm(){
                                var err = '';
                                if($('#phone').val()==''){
                                    err = '请填写手机号码';
                                }else if(IsPhone($('#phone').val())==false){
                                    err = '请填写有效的号码';
                                }

                                if(err==''){
                                    return true;
                                }else{
                                    $('#dialog').dialog({
                                        modal:true, //蒙层（弹出会影响页面大小）
                                        title:'系统提示',
                                        buttons:{"确定":function(){$(this).dialog("close");}}
                                    });
                                    $("#msg").html(err);
                                    return false;
                                }
                            }

                        </script>